//
//  HomeCycleImageCell.m
//  NormalFramework
//
//  Created by beisheng03 on 2018/3/8.
//  Copyright © 2018年 beisheng. All rights reserved.
//

#import "HomeCycleImageCell.h"
#import <SDCycleScrollView/SDCycleScrollView.h>

@interface HomeCycleImageCell ()<SDCycleScrollViewDelegate>
@property (nonatomic, weak) SDCycleScrollView *cycleView;

@property (weak, nonatomic) IBOutlet UIView *topBgView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *topBgH;

@end
@implementation HomeCycleImageCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.topBgH.constant = KScreenW / 69.0 * 28.0;
    
    [self setupTopScrollview];
    // Initialization code
}



- (void)setupTopScrollview{
    
    if (!_cycleView) {
        // 网络加载 --- 创建自定义图片的pageControlDot的图片轮播器
        SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, KScreenW, KScreenW / 69.0 * 28.0) delegate:self placeholderImage:nil];
        
        cycleScrollView.autoScrollTimeInterval = 3;
        cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
        cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
        cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"pageControlCurrentDot"];
        cycleScrollView.pageDotImage = [UIImage imageNamed:@"pageControlDot"];
        _cycleView = cycleScrollView;
        
        
        [self.topBgView addSubview:_cycleView];
        
        
    }
    
    
}



- (void)setUrls:(NSArray *)urls{
    
    _urls = urls;
    
    self.cycleView.imageURLStringsGroup = _urls;
    
}




#pragma mark - SDCycleScrollViewDelegate

/** 点击图片回调 */
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
    
    
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
